<%inherit file="/mtp.html"/>

% if c.preview:
<h1>Preview:</h1>
<div class="wiki_content preview">
    ${c.page_rev.render()}
</div>
% endif

% if c.page:
${h.form(h.url_for('page', id=c.page.urlTitle()), method='PUT', class_="page_edit")}
    <input type="hidden" name="revision" value="${c.page_rev.revision}" />
% else:
${h.form(h.url_for('pages'), method='POST', class_="page_edit")}
% endif


    % for content in c.edit_content_prepend:
        ${content}
    % endfor

    <table>
    <tr>
    <th><label for="title">Title</label></th>
    <td> <input type="text" name="title" value="${c.page.title if c.page else ''}" />
    </tr>

    % for name, content in c.edit_content_insert:
        <tr>
            <th>${name}</th>
            <td>${content}</td>
        </tr>
    % endfor

    <tr>
    <th><label for="body">Body</label></th>
        <td>
            <textarea name="body" rows="20">${c.page_rev.body if c.page_rev else '' | h}</textarea>
        </td>
    </tr>

    <tr>
    <th>
    <label for="comment">Comment</label>
    </th>
    <td>
    <input type="text" name="comment"/>
    </td>
    </tr>

    % for name, content in c.edit_content_append:
    <tr>
        <th>${name}</th>
        <td>${content}</td>
    </tr>
    % endfor
    </table>

    <br/>
    <input type="submit" value="Save" name="action" />
    <input type="submit" value="Cancel" name="action" />
    <input type="submit" value="Preview" name="action" />
</form>

